using System;
using UnityEngine;

namespace CinemaDirector
{
	[Serializable]
	public class SetupState
	{
		public GGVPosition position = new GGVPosition();

		public GGVRotation rotation = new GGVRotation();

		public GGVScale scale = new GGVScale();

		public GGVFloat alpha = new GGVFloat();

		public void SetupFromTransform(Transform trans)
		{
			if (!(trans == null))
			{
				position.storedValue.SetLocalPosition(trans.localPosition);
				rotation.storedValue.SetLocal(trans);
				scale.storedValue.SetLocal(trans);
			}
		}

		public void Setup(Cutscene cutscene, GameObject actor)
		{
			if (!(actor == null) && !(cutscene == null))
			{
				GGVariableStore variables = cutscene.variables;
				position.Init(variables);
				rotation.Init(variables);
				scale.Init(variables);
				alpha.Init(variables);
				Transform transform = actor.transform;
				Position value = position.value;
				if (value.positionType != Position.PositionType.Current)
				{
					transform.position = value.GetWorldPosition(transform);
				}
				Rotation value2 = rotation.value;
				if (value2.angleType != Rotation.AngleType.Current)
				{
					transform.localRotation = Quaternion.Euler(value2.GetLocalEuler(transform));
				}
				Scale value3 = scale.value;
				if (value3.scaleType != Scale.ScaleType.Current)
				{
					transform.localScale = value3.GetLocalScale(transform);
				}
				UIWidget component = actor.GetComponent<UIWidget>();
				if (!(component == null) && alpha.valueType != ValueType.Current)
				{
					component.alpha = alpha.value;
				}
			}
		}
	}
}
